package com.jhmk.springboot.config;

import com.jhmk.springboot.jobs.MyFristJob;
import org.quartz.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

//@Configuration
public class QuartZConfig {

    @Bean
    public JobDetail jobDetail(){

        return  JobBuilder.newJob(MyFristJob.class).storeDurably().build();
    }
    @Bean
    public Trigger tigger1(){
        SimpleScheduleBuilder simpleScheduleBuilder=SimpleScheduleBuilder.simpleSchedule()
                .withIntervalInSeconds(1)
                .repeatForever();
        return TriggerBuilder.newTrigger()
                .withIdentity("trigger1","group1")
                .withSchedule(simpleScheduleBuilder)
                .forJob(jobDetail())
                .build();

    }
}
